/*
 * File:        dataTables.editor.min.js
 * Version:     1.2.1
 * Author:      SpryMedia (www.sprymedia.co.uk)
 * Info:        http://editor.datatables.net
 * 
 * Copyright 2012 SpryMedia, all rights reserved.
 * License: DataTables Editor - http://editor.datatables.net/license
 */
/*
     DataTables Editor: http://editor.datatables.net/license
*/
(function(m,o,n,e,k){var d=function(a){!this instanceof d&&alert("DataTables Editor must be initilaised as a 'new' instance'");this._constructor(a)};k.Editor=d;d.models={};d.models.displayController={init:function(){},open:function(){},close:function(){}};d.models.field={name:null,dataProp:"",label:"",id:"",type:"text",fieldInfo:"",labelInfo:"","default":"",dataSourceGet:null,dataSourceSet:null,el:null,_fieldMessage:null,_fieldInfo:null,_fieldError:null,_labelInfo:null};d.models.fieldType={create:function(){},
get:function(){},set:function(){},enable:function(){},disable:function(){}};d.models.settings={ajaxUrl:"",ajax:null,domTable:null,dbTable:"",opts:null,displayController:null,fields:[],id:-1,displayed:!1,processing:!1,editRow:null,removeRows:null,action:null,events:{onProcessing:[],onPreOpen:[],onOpen:[],onPreClose:[],onClose:[],onPreSubmit:[],onPostSubmit:[],onSubmitComplete:[],onSubmitSuccess:[],onSubmitError:[],onInitCreate:[],onPreCreate:[],onCreate:[],onPostCreate:[],onInitEdit:[],onPreEdit:[],
onEdit:[],onPostEdit:[],onInitRemove:[],onPreRemove:[],onRemove:[],onPostRemove:[],onSetData:[],onInitComplete:[]}};d.models.button={label:null,fn:null,className:null};d.display={};var i=jQuery,g;d.display.lightbox=i.extend(!0,{},d.models.displayController,{init:function(){g._init();return g},open:function(a,c,b){if(g._shown)b&&b();else{g._dte=a;i(g._dom.content).children().detach();g._dom.content.appendChild(c);g._dom.content.appendChild(g._dom.close);g._shown=true;g._show(b)}},close:function(a,
c){if(g._shown){g._dte=a;g._hide(c);g._shown=false}else c&&c()},_init:function(){if(!g._ready){g._dom.content=i("div.DTED_Lightbox_Content",g._dom.wrapper)[0];o.body.appendChild(g._dom.background);o.body.appendChild(g._dom.wrapper);g._dom.background.style.visbility="hidden";g._dom.background.style.display="block";g._cssBackgroundOpacity=i(g._dom.background).css("opacity");g._dom.background.style.display="none";g._dom.background.style.visbility="visible";i(g._dom.close).click(function(){g._dte.close("icon")});
i(g._dom.background).click(function(){g._dte.close("background")});i("div.DTED_Lightbox_Content_Wrapper",g._dom.wrapper).click(function(a){i(a.target).hasClass("DTED_Lightbox_Content_Wrapper")&&g._dte.close("background")});i(m).resize(function(){g._heightCalc()})}},_show:function(a){a||(a=function(){});g._dom.content.style.height="auto";var c=g._dom.wrapper.style;c.opacity=0;c.display="block";g._heightCalc();c.display="none";c.opacity=1;i(g._dom.wrapper).fadeIn();g._dom.background.style.opacity=0;
g._dom.background.style.display="block";i(g._dom.background).animate({opacity:g._cssBackgroundOpacity},"normal",a)},_heightCalc:function(){g.conf.heightCalc?g.conf.heightCalc(g._dom.wrapper):i(g._dom.content).children().height();var a=i(m).height()-g.conf.windowPadding*2-i("div.DTE_Header",g._dom.wrapper).outerHeight()-i("div.DTE_Footer",g._dom.wrapper).outerHeight();i("div.DTE_Body_Content",g._dom.wrapper).css("maxHeight",a)},_hide:function(a){a||(a=function(){});i([g._dom.wrapper,g._dom.background]).fadeOut("normal",
a)},_dte:null,_ready:!1,_shown:!1,_cssBackgroundOpacity:1,_dom:{wrapper:i('<div class="DTED_Lightbox_Wrapper"><div class="DTED_Lightbox_Container"><div class="DTED_Lightbox_Content_Wrapper"><div class="DTED_Lightbox_Content"></div></div></div></div>')[0],background:i('<div class="DTED_Lightbox_Background"></div>')[0],close:i('<div class="DTED_Lightbox_Close"></div>')[0],content:null}});g=d.display.lightbox;g.conf={windowPadding:100,heightCalc:null};var h=jQuery,f;d.display.envelope=h.extend(!0,{},
d.models.displayController,{init:function(a){f._dte=a;f._init();return f},open:function(a,c,b){f._dte=a;h(f._dom.content).children().detach();f._dom.content.appendChild(c);f._dom.content.appendChild(f._dom.close);f._show(b)},close:function(a,c){f._dte=a;f._hide(c)},_init:function(){if(!f._ready){f._dom.content=h("div.DTED_Envelope_Container",f._dom.wrapper)[0];o.body.appendChild(f._dom.background);o.body.appendChild(f._dom.wrapper);f._dom.background.style.visbility="hidden";f._dom.background.style.display=
"block";f._cssBackgroundOpacity=h(f._dom.background).css("opacity");f._dom.background.style.display="none";f._dom.background.style.visbility="visible";h(f._dom.close).click(function(){f._dte.close("icon")});h(f._dom.background).click(function(){f._dte.close("background")});h("div.DTED_Envelope_Content_Wrapper",f._dom.wrapper).click(function(a){h(a.target).hasClass("DTED_Envelope_Content_Wrapper")&&f._dte.close("background")});h(m).resize(function(){f._heightCalc()})}},_show:function(a){a||(a=function(){});
f._dom.content.style.height="auto";var c=f._dom.wrapper.style;c.opacity=0;c.display="block";var b=f._findAttachRow(),e=f._heightCalc(),j=b.offsetWidth;c.display="none";c.opacity=1;f._dom.wrapper.style.width=j+"px";f._dom.wrapper.style.marginLeft=-(j/2)+"px";f._dom.wrapper.style.top=h(b).offset().top+b.offsetHeight+"px";f._dom.content.style.top=-1*e-20+"px";f._dom.background.style.opacity=0;f._dom.background.style.display="block";h(f._dom.background).animate({opacity:f._cssBackgroundOpacity},"normal");
h(f._dom.wrapper).fadeIn();f.conf.windowScroll?h("html,body").animate({scrollTop:h(b).offset().top+b.offsetHeight-f.conf.windowPadding},function(){h(f._dom.content).animate({top:0},600,a)}):h(f._dom.content).animate({top:0},600,a)},_heightCalc:function(){f.conf.heightCalc?f.conf.heightCalc(f._dom.wrapper):h(f._dom.content).children().height();var a=h(m).height()-f.conf.windowPadding*2-h("div.DTE_Header",f._dom.wrapper).outerHeight()-h("div.DTE_Footer",f._dom.wrapper).outerHeight();h("div.DTE_Body_Content",
f._dom.wrapper).css("maxHeight",a);return h(f._dte.dom.wrapper).outerHeight()},_hide:function(a){a||(a=function(){});h(f._dom.content).animate({top:-(f._dom.content.offsetHeight+50)},600,function(){h([f._dom.wrapper,f._dom.background]).fadeOut("normal",a)})},_findAttachRow:function(){if(f.conf.attach==="head"||f._dte.s.action==="create")return h(f._dte.s.domTable).dataTable().fnSettings().nTHead;if(f._dte.s.action==="edit")return f._dte.s.editRow;if(f._dte.s.action==="remove")return f._dte.s.removeRows[0]},
_dte:null,_ready:!1,_cssBackgroundOpacity:1,_dom:{wrapper:h('<div class="DTED_Envelope_Wrapper"><div class="DTED_Envelope_ShadowLeft"></div><div class="DTED_Envelope_ShadowRight"></div><div class="DTED_Envelope_Container"></div></div>')[0],background:h('<div class="DTED_Envelope_Background"></div>')[0],close:h('<div class="DTED_Envelope_Close">&times;</div>')[0],content:null}});f=d.display.envelope;f.conf={windowPadding:50,heightCalc:null,attach:"row",windowScroll:!0};d.prototype.add=function(a){var c=
this,b=this.classes.field;if(e.isArray(a))for(var b=0,f=a.length;b<f;b++)this.add(a[b]);else a=e.extend(!0,{},d.models.field,a),a.id="DTE_Field_"+a.name,""===a.dataProp&&(a.dataProp=a.name),a.dataSourceGet=function(){var b=e(c.s.domTable).dataTable().oApi._fnGetObjectDataFn(a.dataProp);a.dataSourceGet=b;return b.apply(c,arguments)},a.dataSourceSet=function(){var b=e(c.s.domTable).dataTable().oApi._fnSetObjectDataFn(a.dataProp);a.dataSourceSet=b;return b.apply(c,arguments)},b=e('<div class="'+b.wrapper+
" "+b.typePrefix+a.type+" "+b.namePrefix+a.name+'"><label data-dte-e="label" class="'+b.label+'" for="'+a.id+'">'+a.label+'<div data-dte-e="msg-label" class="'+b["msg-label"]+'">'+a.labelInfo+'</div></label><div data-dte-e="input" class="'+b.input+'"><div data-dte-e="msg-error" class="'+b["msg-error"]+'"></div><div data-dte-e="msg-message" class="'+b["msg-message"]+'"></div><div data-dte-e="msg-info" class="'+b["msg-info"]+'">'+a.fieldInfo+"</div></div></div>")[0],f=d.fieldTypes[a.type].create.call(this,
a),null!==f?this._$("input",b).prepend(f):b.style.display="none",this.dom.formContent.appendChild(b),this.dom.formContent.appendChild(this.dom.formClear),a.el=b,a._fieldInfo=this._$("msg-info",b)[0],a._labelInfo=this._$("msg-label",b)[0],a._fieldError=this._$("msg-error",b)[0],a._fieldMessage=this._$("msg-message",b)[0],this.s.fields.push(a)};d.prototype.buttons=function(a){var c=this,b,f,j;if(e.isArray(a)){e(this.dom.buttons).empty();var d=function(a){return function(b){b.preventDefault();a.fn&&
a.fn.call(c)}};b=0;for(f=a.length;b<f;b++)j=o.createElement("button"),a[b].label&&(j.innerHTML=a[b].label),a[b].className&&(j.className=a[b].className),e(j).click(d(a[b])),this.dom.buttons.appendChild(j)}else this.buttons([a])};d.prototype.clear=function(a){if(a)if(e.isArray(a))for(var c=0,b=a.length;c<b;c++)this.clear(a[c]);else{if(a=this._findFieldIndex(a))e(this.s.fields[a].el).remove(),this.s.fields.splice(a,1)}else e("div."+this.classes.field.wrapper,this.dom.wrapper).remove(),this.s.fields.splice(0,
this.s.fields.length)};d.prototype.close=function(a){var c=this;this._display("close",function(){c._clearDynamicInfo()},a)};d.prototype.create=function(a,c,b){var f=this,j=this.s.fields;this.s.id="";this.s.action="create";this.dom.form.style.display="block";this._actionClass();a&&this.title(a);c&&this.buttons(c);a=0;for(c=j.length;a<c;a++)this.field(j[a].name).set(j[a]["default"]);this._callbackFire("onInitCreate");(b===n||b)&&this._display("open",function(){e("input:visible,select:visible,textarea:visible",
f.dom.wrapper).filter(":eq(0)").focus()})};d.prototype.disable=function(a){if(e.isArray(a))for(var c=0,b=a.length;c<b;c++)this.disable(a[c]);else this.field(a).disable()};d.prototype.edit=function(a,c,b,f){var j=this;this.s.id=a.id;this.s.editRow=a;this.s.action="edit";this.dom.form.style.display="block";this._actionClass();c&&this.title(c);b&&this.buttons(b);a=e(this.s.domTable).dataTable()._(a)[0];c=0;for(b=this.s.fields.length;c<b;c++){var d=this.s.fields[c],g=d.dataSourceGet(a,"editor");this.field(d.name).set(""!==
d.dataProp&&g!==n?g:d["default"])}this._callbackFire("onInitEdit");(f===n||f)&&this._display("open",function(){e("input:visible,select:visible,textarea:visible",j.dom.wrapper).filter(":eq(0)").focus()})};d.prototype.enable=function(a){if(e.isArray(a))for(var c=0,b=a.length;c<b;c++)this.enable(a[c]);else this.field(a).enable()};d.prototype.error=function(a,c){if(c){var b=this._findField(a);b&&(this._message(b._fieldError,"slide",c),e(b.el).addClass(this.classes.field.error))}else this._message(this.dom.formError,
"fade",a)};d.prototype.field=function(a){var c=this,b={},f=this._findField(a),j=d.fieldTypes[f.type];e.each(j,function(a,e){b[a]="function"===typeof e?function(){var b=[].slice.call(arguments);b.unshift(f);return j[a].apply(c,b)}:e});return b};d.prototype.fields=function(){for(var a=[],c=0,b=this.s.fields.length;c<b;c++)a.push(this.s.fields[c].name);return a};d.prototype.get=function(a){var c=this,b={};return a===n?(e.each(this.fields(),function(a,e){b[e]=c.get(e)}),b):this.field(a).get()};d.prototype.hide=
function(a){var c,b;if(a)if(e.isArray(a)){c=0;for(b=a.length;c<b;c++)this.hide(a[c])}else{if(a=this._findField(a))this.s.displayed?e(a.el).slideUp():a.el.style.display="none"}else{c=0;for(b=this.s.fields.length;c<b;c++)this.hide(this.s.fields[c].name)}};d.prototype.message=function(a,c){if(c){var b=this._findField(a);this._message(b._fieldMessage,"slide",c)}else this._message(this.dom.formInfo,"fade",a)};d.prototype.off=function(a,c){"function"===typeof e().off?e(this).off(a,c):e(this).unbind(a,c)};
d.prototype.on=function(a,c){if("function"===typeof e().on)e(this).on(a,c);else e(this).bind(a,c)};d.prototype.open=function(){this._display("open")};d.prototype.remove=function(a,c,b,f){e.isArray(a)?(this.s.id="",this.s.action="remove",this.s.removeRows=a,this.dom.form.style.display="none",this._actionClass(),c&&this.title(c),b&&this.buttons(b),this._callbackFire("onInitRemove"),(f===n||f)&&this._display("open")):this.remove([a],c,b,f)};d.prototype.set=function(a,c){this.field(a).set(c)};d.prototype.show=
function(a){var c,b;if(a)if(e.isArray(a)){c=0;for(b=a.length;c<b;c++)this.show(a[c])}else{if(a=this._findField(a))this.s.displayed?e(a.el).slideDown():a.el.style.display="block"}else{c=0;for(b=this.s.fields.length;c<b;c++)this.show(this.s.fields[c].name)}};d.prototype.submit=function(a,c,b,f){var j=this,d=!0;if(!this.s.processing&&this.s.action){this._processing(!0);var g=e('div[data-dte-e="msg-error"]:visible',this.dom.wrapper);0<g.length?g.slideUp(function(){d&&(j._submit(a,c,b,f),d=!1)}):this._submit(a,
c,b,f);e("div."+this.classes.field.error,this.dom.wrapper).removeClass(this.classes.field.error);e(this.dom.formError).fadeOut()}};d.prototype.title=function(a){this.dom.header.innerHTML=a};d.prototype._constructor=function(a){a=e.extend(!0,{},d.defaults,a);this.s=e.extend(!0,{},d.models.settings);this.classes=e.extend(!0,{},d.classes);var c=this,b=this.classes;this.dom={wrapper:e('<div class="'+b.wrapper+'"><div data-dte-e="processing" class="'+b.processing.indicator+'"></div><div data-dte-e="head" class="'+
b.header.wrapper+'"><div data-dte-e="head_content" class="'+b.header.content+'"></div></div><div data-dte-e="body" class="'+b.body.wrapper+'"><div data-dte-e="body_content" class="'+b.body.content+'"><div data-dte-e="form_info" class="'+b.form.info+'"></div><form data-dte-e="form" class="'+b.form.tag+'"><div data-dte-e="form_content" class="'+b.form.content+'"><div data-dte-e="form_clear" class="'+b.form.clear+'"></div></div></form></div></div><div data-dte-e="foot" class="'+b.footer.wrapper+'"><div data-dte-e="foot_content" class="'+
b.footer.content+'"><div data-dte-e="form_error" class="'+b.form.error+'"></div><div data-dte-e="form_buttons" class="'+b.form.buttons+'"></div></div></div></div>')[0],form:null,formClear:null,formError:null,formInfo:null,formContent:null,header:null,body:null,bodyContent:null,footer:null,processing:null,buttons:null};this.s.domTable=a.domTable;this.s.dbTable=a.dbTable;this.s.ajaxUrl=a.ajaxUrl;this.s.ajax=a.ajax;this.i18n=a.i18n;if(m.TableTools){var f=m.TableTools.BUTTONS,j=this.i18n;e.each(["create",
"edit","remove"],function(a,c){f["editor_"+c].sButtonText=j[c].button;f["editor_"+c].formTitle=j[c].title;f["editor_"+c].formButtons[0].label=j[c].submit});f.editor_remove.question=function(a){return("string"===j.remove.confirm?j.remove.confirm:j.remove.confirm[a]?j.remove.confirm[a]:j.remove.confirm._).replace(/%d/g,a)}}e.each(a.events,function(a,b){c._callbackReg(a,b,"User")});var b=this.dom,g=b.wrapper;b.form=this._$("form",g)[0];b.formClear=this._$("form_clear",g)[0];b.formError=this._$("form_error",
g)[0];b.formInfo=this._$("form_info",g)[0];b.formContent=this._$("form_content",g)[0];b.header=this._$("head_content",g)[0];b.body=this._$("body",g)[0];b.bodyContent=this._$("body_content",g)[0];b.footer=this._$("foot",g)[0];b.processing=this._$("processing",g)[0];b.buttons=this._$("form_buttons",g)[0];""!==this.s.dbTable&&e(this.dom.wrapper).addClass("DTE_Table_Name_"+this.s.dbTable);if(a.fields){b=0;for(g=a.fields.length;b<g;b++)this.add(a.fields[b])}e(this.dom.form).submit(function(a){c.submit();
a.preventDefault()});this.s.displayController=d.display[a.display].init(this);this._callbackFire("onInitComplete",[])};d.prototype._$=function(a,c){c===n&&(c=o);return e('*[data-dte-e="'+a+'"]',c)};d.prototype._actionClass=function(){var a=this.classes.actions;e(this.dom.wrapper).removeClass([a.create,a.edit,a.remove].join(" "));"create"===this.s.action?e(this.dom.wrapper).addClass(a.create):"edit"===this.s.action?e(this.dom.wrapper).addClass(a.edit):"remove"===this.s.action&&e(this.dom.wrapper).addClass(a.remove)};
d.prototype._callbackFire=function(a,c){var b,f;if(e.isArray(a))for(b=0;b<a.length;b++)this._callbackFire(a[b],c);else{var j=this.s.events[a],d=[];b=0;for(f=j.length;b<f;b++)d.push(j[b].fn.apply(this,c));null!==a&&(b=e.Event(a),e(this).trigger(b,c),d.push(b.result));return d}};d.prototype._callbackReg=function(a,c,b){c&&this.s.events[a].push({fn:c,name:b})};d.prototype._clearDynamicInfo=function(){e("div."+this.classes.field.error,this.dom.wrapper).removeClass(this.classes.field.error);this._$("msg-error",
this.dom.wrapper).html("").css("display","none");this.error("");this.message("")};d.prototype._display=function(a,c,b){var f=this;"open"===a?(a=this._callbackFire("onPreOpen",[b]),-1===e.inArray(!1,a)&&(f.s.displayed=!0,this.s.displayController.open(this,this.dom.wrapper,function(){c&&c()}),this._callbackFire("onOpen"))):"close"===a&&(a=this._callbackFire("onPreClose",[b]),-1===e.inArray(!1,a)&&(this.s.displayController.close(this,function(){f.s.displayed=!1;c&&c()}),this._callbackFire("onClose")))};
d.prototype._findField=function(a){for(var c=0,b=this.s.fields.length;c<b;c++)if(this.s.fields[c].name===a)return this.s.fields[c];return n};d.prototype._findFieldIndex=function(a){for(var c=0,b=this.s.fields.length;c<b;c++)if(this.s.fields[c].name===a)return c;return n};d.prototype._message=function(a,c,b){""===b&&this.s.displayed?"slide"===c?e(a).slideUp():e(a).fadeOut():""===b?a.style.display="none":this.s.displayed?"slide"===c?e(a).html(b).slideDown():e(a).html(b).fadeIn():(e(a).html(b),a.style.display=
"block")};d.prototype._processing=function(a){(this.s.processing=a)?(this.dom.processing.style.display="block",e(this.dom.wrapper).addClass(this.classes.processing.active)):(this.dom.processing.style.display="none",e(this.dom.wrapper).removeClass(this.classes.processing.active));this._callbackFire("onProcessing",[a])};d.prototype._ajaxUri=function(a){a="create"===this.s.action&&this.s.ajaxUrl.create?this.s.ajaxUrl.create:"edit"===this.s.action&&this.s.ajaxUrl.edit?this.s.ajaxUrl.edit.replace(/_id_/,
this.s.id):"remove"===this.s.action&&this.s.ajaxUrl.remove?this.s.ajaxUrl.remove.replace(/_id_/,a.join(",")):this.s.ajaxUrl;return-1!==a.indexOf(" ")?(a=a.split(" "),{method:a[0],url:a[1]}):{method:"POST",url:a}};d.prototype._submit=function(a,c,b,f){var d=this,g,h,i,l=e(this.s.domTable).dataTable(),k={action:this.s.action,table:this.s.dbTable,id:this.s.id,data:{}};if("create"===this.s.action||"edit"===this.s.action)e.each(this.s.fields,function(a,c){i=l.oApi._fnSetObjectDataFn(c.name);i(k.data,d.get(c.name))});
else{k.data=[];g=0;for(h=this.s.removeRows.length;g<h;g++)k.data.push(this.s.removeRows[g].id)}b&&b(k);b=this._callbackFire("onPreSubmit",[k]);-1!==e.inArray(!1,b)?this._processing(!1):(b=this._ajaxUri(k.data),this.s.ajax(b.method,b.url,k,function(b){d._callbackFire("onPostSubmit",[b,k]);b.error||(b.error="");b.fieldErrors||(b.fieldErrors=[]);if(""!==b.error||0!==b.fieldErrors.length){d.error(b.error);g=0;for(h=b.fieldErrors.length;g<h;g++)d._findField(b.fieldErrors[g].name),d.error(b.fieldErrors[g].name,
b.fieldErrors[g].status);0<b.fieldErrors.length&&e(d.dom.bodyContent,d.s.wrapper).animate({scrollTop:e("div."+d.classes.field.error+":eq(0)").position().top},600);c&&c.call(d,b)}else{var i=b.row?b.row:{};if(!b.row){g=0;for(h=d.s.fields.length;g<h;g++){var m=d.s.fields[g];null!==m.dataProp&&m.dataSourceSet(i,d.field(m.name).get())}}d._callbackFire("onSetData",[b,i,d.s.action]);if(l.fnSettings().oFeatures.bServerSide)l.fnDraw();else if("create"===d.s.action)i.DT_RowId=b.id,d._callbackFire("onPreCreate",
[b,i]),l.fnAddData(i),d._callbackFire(["onCreate","onPostCreate"],[b,i]);else if("edit"===d.s.action)d._callbackFire("onPreEdit",[b,i]),l.fnUpdate(i,d.s.editRow),d._callbackFire(["onEdit","onPostEdit"],[b,i]);else if("remove"===d.s.action){d._callbackFire("onPreRemove",[b]);g=0;for(h=d.s.removeRows.length;g<h;g++)l.fnDeleteRow(d.s.removeRows[g],!1);l.fnDraw();d._callbackFire(["onRemove","onPostRemove"],[b])}d.s.action=null;(f===n||f)&&d._display("close",function(){d._clearDynamicInfo()},"submit");
a&&a.call(d,b);d._callbackFire(["onSubmitSuccess","onSubmitComplete"],[b,i])}d._processing(!1)},function(a,b,e){d._callbackFire("onPostSubmit",[a,b,e,k]);d.error(d.i18n.error.system);d._processing(!1);c&&c.call(d,a,b,e);d._callbackFire(["onSubmitError","onSubmitComplete"],[a,b,e,k])}))};d.defaults={domTable:null,ajaxUrl:"",fields:[],dbTable:"",display:"lightbox",ajax:function(a,c,b,d,f){e.ajax({type:a,url:c,data:b,dataType:"json",success:function(a){d(a)},error:function(a,b,c){f(a,b,c)}})},events:{onProcessing:null,
onOpen:null,onPreOpen:null,onClose:null,onPreClose:null,onPreSubmit:null,onPostSubmit:null,onSubmitComplete:null,onSubmitSuccess:null,onSubmitError:null,onInitCreate:null,onPreCreate:null,onCreate:null,onPostCreate:null,onInitEdit:null,onPreEdit:null,onEdit:null,onPostEdit:null,onInitRemove:null,onPreRemove:null,onRemove:null,onPostRemove:null,onSetData:null,onInitComplete:null},i18n:{create:{button:"New",title:"Create new entry",submit:"Create"},edit:{button:"Edit",title:"Edit entry",submit:"Update"},
remove:{button:"Delete",title:"Delete",submit:"Delete",confirm:{_:"Are you sure you wish to delete %d rows?",1:"Are you sure you wish to delete 1 row?"}},error:{system:"An error has occurred - Please contact the system administrator"}}};d.classes={wrapper:"DTE",processing:{indicator:"DTE_Processing_Indicator",active:"DTE_Processing"},header:{wrapper:"DTE_Header",content:"DTE_Header_Content"},body:{wrapper:"DTE_Body",content:"DTE_Body_Content"},footer:{wrapper:"DTE_Footer",content:"DTE_Footer_Content"},
form:{wrapper:"DTE_Form",content:"DTE_Form_Content",tag:"",info:"DTE_Form_Info",clear:"DTE_Form_Clear",error:"DTE_Form_Error",buttons:"DTE_Form_Buttons"},field:{wrapper:"DTE_Field",typePrefix:"DTE_Field_Type_",namePrefix:"DTE_Field_Name_",label:"DTE_Label",input:"DTE_Field_Input",error:"DTE_Field_StateError","msg-label":"DTE_Label_Info","msg-error":"DTE_Field_Error","msg-message":"DTE_Field_Message","msg-info":"DTE_Field_Info"},actions:{create:"DTE_Action_Create",edit:"DTE_Action_Edit",remove:"DTE_Action_Remove"}};
m.TableTools&&(k=m.TableTools.BUTTONS,k.editor_create=e.extend(!0,k.text,{sButtonText:null,editor:null,formTitle:null,formButtons:[{label:null,fn:function(){this.submit()}}],fnClick:function(a,c){c.editor.create(c.formTitle,c.formButtons)}}),k.editor_edit=e.extend(!0,k.select_single,{sButtonText:null,editor:null,formTitle:null,formButtons:[{label:null,fn:function(){this.submit()}}],fnClick:function(a,c){var b=this.fnGetSelected();b.length===1&&c.editor.edit(b[0],c.formTitle,c.formButtons)}}),k.editor_remove=
e.extend(!0,k.select,{sButtonText:null,editor:null,formTitle:null,formButtons:[{label:null,fn:function(){var a=this;this.submit(function(){m.TableTools.fnGetInstance(e(a.s.domTable)[0]).fnSelectNone()})}}],question:null,fnClick:function(a,c){var b=this.fnGetSelected();if(b.length!==0){c.editor.message(typeof c.question==="function"?c.question(b.length):c.question);c.editor.remove(b,c.formTitle,c.formButtons)}}}));d.fieldTypes={};var p=function(a){return e.isPlainObject(a)?{val:a.value!==n?a.value:
a.label,label:a.label}:{val:a,label:a}},l=d.fieldTypes,k=e.extend(!0,{},d.models.fieldType,{get:function(a){return a._input.value},set:function(a,c){a._input.value=c},enable:function(a){a._input.disabled=false},disable:function(a){a._input.disabled=true}});l.hidden=e.extend(!0,{},k,{create:function(a){a._val=a.value;return null},get:function(a){return a._val},set:function(a,c){a._val=c}});l.readonly=e.extend(!0,{},k,{create:function(a){a._input=e('<input id="'+a.id+'" readonly="readonly">')[0];return a._input}});
l.text=e.extend(!0,{},k,{create:function(a){a._input=e('<input id="'+a.id+'">')[0];return a._input}});l.password=e.extend(!0,{},k,{create:function(a){a._input=e('<input id="'+a.id+'" type="password">')[0];return a._input}});l.textarea=e.extend(!0,{},k,{create:function(a){a._input=e('<textarea id="'+a.id+'">')[0];return a._input}});l.select=e.extend(!0,{},k,{_addOptions:function(a,c){var b=a._input.options;b.length=0;if(c)for(var e=0,d=c.length;e<d;e++){var f=p(c[e]);b[e]=new Option(f.label,f.val)}},
create:function(a){a._input=e('<select id="'+a.id+'">')[0];l.select._addOptions(a,a.ipOpts);return a._input},get:function(a){return e(a._input).val()},set:function(a,c){e(a._input).val(c)},update:function(a,c){var b=e(a._input).val();l.select._addOptions(a,c);e(a._input).val(b)}});l.checkbox=e.extend(!0,{},k,{_addOptions:function(a,c){var b=e(a._input).empty();if(c)for(var d=0,f=c.length;d<f;d++){var g=p(c[d]);b.append('<div><input id="'+a.id+"_"+d+'" type="checkbox" value="'+g.val+'" /><label for="'+
a.id+"_"+d+'">'+g.label+"</label></div>")}},create:function(a){a._input=e("<div>")[0];l.checkbox._addOptions(a,a.ipOpts);return a._input},get:function(a){var c=[];e("input:checked",a._input).each(function(){c.push(this.value)});return c},set:function(a,c){var b=e("input",a._input);!e.isArray(c)&&typeof c==="string"?c=c.split("|"):e.isArray(c)||(c=[c]);var d,f=c.length,g;b.each(function(){g=false;for(d=0;d<f;d++)if(this.value==c[d]){g=true;break}this.checked=g})},enable:function(a){e("input",a._input).attr("disabled",
false)},disable:function(a){e("input",a._input).attr("disabled",true)},update:function(a,c){var b=l.checkbox.get(a);l.checkbox._addOptions(a,c);l.checkbox.get(a,b)}});l.radio=e.extend(!0,{},k,{_addOptions:function(a,c){var b=e(a._input).empty();if(c)for(var d=0,f=c.length;d<f;d++){var g=p(c[d]);b.append('<div><input id="'+a.id+"_"+d+'" type="radio" name="'+a.name+'" /><label for="'+a.id+"_"+d+'">'+g.label+"</label></div>");e("input:last",b).attr("value",g.val)}},create:function(a){a._input=e("<div>")[0];
l.radio._addOptions(a,a.ipOpts);this.on("onOpen",function(){e("input",a._input).each(function(){if(this._preChecked)this.checked=true})});return a._input},get:function(a){return e("input:checked",a._input).val()},set:function(a,c){e("input",a._input).each(function(){this._preChecked=false;if(this.value==c)this._preChecked=this.checked=true})},enable:function(a){e("input",a._input).attr("disabled",false)},disable:function(a){e("input",a._input).attr("disabled",true)},update:function(a,c){var b=l.radio.get(a);
l.radio._addOptions(a,c);l.radio.get(a,b)}});l.date=e.extend(!0,{},k,{create:function(a){a._input=e('<input id="'+a.id+'">')[0];if(!a.dateFormat)a.dateFormat=e.datepicker.RFC_2822;if(!a.dateImage)a.dateImage="../media/images/calender.png";e(this).bind("onInitComplete",function(){e(a._input).datepicker({showOn:"both",dateFormat:a.dateFormat,buttonImage:a.dateImage,buttonImageOnly:true});e("#ui-datepicker-div").css("display","none")});return a._input},get:function(a){return a._input.value},set:function(a,
c){e(a._input).datepicker("setDate",c)},enable:function(a){e(a._input).datepicker("enable")},disable:function(a){e(a._input).datepicker("disable")}});d.prototype.CLASS="Editor";d.VERSION="1.2.1";d.prototype.VERSION=d.VERSION})(window,document,void 0,jQuery,jQuery.fn.dataTable);
